home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / Menus / Scenes / HOME.dir / 00049_Script_Link_beh < prev    next >
Text File  |  2006-04-20  |  2KB  |  89 lines

  1. global currentmember,pointclicked,wordnum,wordtext2,wordtext
  2. property Sp
  3.  
  4. on mouseup me
  5.   
  6.   wordText = currentMember.word[wordNum]
  7.   --    put "Clicked word" && wordNum & ", the text" && wordText
  8.   
  9.   if wordtext contains "@" then
  10.     -- alert "you clicked email address"&&wordtext
  11.     gotonetpage ("mailto:"&wordtext)
  12.   else
  13.     nothing
  14.   end if
  15.   
  16.   if wordtext.char[1..7] = "http://" then
  17.     gotonetpage (wordtext)
  18.   else 
  19.     nothing
  20.   end if
  21.   
  22.   if wordtext.char[1..8] = "https://" then
  23.     gotonetpage (wordtext)
  24.   else 
  25.     nothing
  26.   end if
  27.   
  28.   if wordtext.char[1..4] = "www." then
  29.     gotonetpage ("http://"&wordtext)
  30.   else 
  31.     nothing
  32.   end if
  33.   
  34.   
  35. end
  36.  
  37. on init me
  38.   
  39.   Sp = sprite(me.spritenum)
  40.   pFormat()
  41.   
  42. end
  43.  
  44.  
  45. on pFormat me
  46.   
  47.   t = Sp.member
  48.   
  49.   
  50.   repeat with i = 1 to t.word.count
  51.     if t.word[i].char[1..7] = "http://" or t.word[i] contains "@" or t.word[i].char[1..4] = "www." or t.word[i].char[1..8] = "https://" then
  52.       
  53.       t.word[i].color = rgb(20,20,255)
  54.       t.word[i].fontstyle = [#plain]
  55.     end if
  56.     
  57.   end repeat
  58.   
  59. end
  60.  
  61.  
  62.  
  63. on mousewithin me
  64.   --cursor on
  65.   
  66.   pointClicked = the mouseLoc
  67.   currentMember = sprite(me.spriteNum).member
  68.   wordNum = sprite(me.spriteNum).pointToWord(pointClicked)
  69.   
  70.   if wordnum <> -1 then
  71.     wordText2 = currentMember.word[wordNum]
  72.     
  73.     
  74.     
  75.     if wordtext2.char[1..7] = "http://" or wordtext2 contains "@" or wordtext2.char[1..4] = "www." or wordtext2.char[1..8] = "https://"then
  76.       cursor 280
  77.  
  78.     else
  79.       cursor -1
  80.     end if
  81.     
  82.   end if
  83. end
  84.  
  85.  
  86. on mouseleave
  87. cursor -1
  88. end
  89.